package dfs;

public class Demo20250706 {
/*    // 头插法
    public ListNode reverseList(ListNode head) {
        if (head == null) return head;
        ListNode cur = head.next;
        head.next = null;
        while (cur != null) {
            ListNode curN = cur.next;
            cur.next = head;
            head = cur;
            cur = curN;
        }
        return head;
    }*/


/*     // 递归
     public ListNode reverseList(ListNode head) {
         if (head == null || head.next == null) return head;
         ListNode newHead = reverseList(head.next);
         head.next.next = head;
         head.next = null;
         return newHead;
     }*/
}
